package vip.xiaonuo.smzq.modular.psba.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.kcl.entity.vo.ReservesEdit;
import vip.xiaonuo.smzq.modular.psba.entity.PsbaGtBg;
import vip.xiaonuo.smzq.modular.psba.entity.PsbaGtJbqk;
import vip.xiaonuo.smzq.modular.psba.entity.param.PsbaXqParam;
import vip.xiaonuo.smzq.modular.psba.entity.vo.PsbaXqVo;
import vip.xiaonuo.smzq.modular.psba.entity.vo.PsbaZycledit;
import vip.xiaonuo.smzq.modular.psba.entity.vo.PsbakczyclVo;
import vip.xiaonuo.smzq.modular.psba.service.IPsbaGtJbqkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


/**
 * 评审备案-非压覆基本情况
 *
 * @author Kevin
 * @since 2024-05-15
 */
@Api(tags = "评审备案-非压覆基本情况")
@RestController
@RequestMapping("/psba/psbaGtJbqk")
@Validated
public class PsbaGtJbqkController {

    @Resource
    private IPsbaGtJbqkService iPsbaGtJbqkService;

    /**
     * 添加评审备案-非压覆基本情况
     */
    @ApiOperation("添加评审备案-非压覆基本情况")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid PsbaGtJbqk psbaGtJbqk) {
        iPsbaGtJbqkService.save(psbaGtJbqk);
        return CommonResult.ok();
    }

    /**
     * 删除评审备案-非压覆基本情况
     */
    @ApiOperation("删除评审备案-非压覆基本情况")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iPsbaGtJbqkService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑评审备案-非压覆基本情况
     */
    @ApiOperation("编辑评审备案-非压覆基本情况")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid PsbaGtJbqk psbaGtJbqk) {
        iPsbaGtJbqkService.updateById(psbaGtJbqk);
        return CommonResult.ok();
    }

    /**
     * 评审备案-非压覆基本情况分页查询
     */
    @ApiOperation("评审备案-非压覆基本情况分页查询")
    @GetMapping("/list")
    public CommonResult<Page<PsbaGtJbqk>> page(
            @ApiParam(name = "current", value = "页数", example = "1", required = true)  @RequestParam long current,
            @ApiParam(name = "size", value = "每页数量", example = "20", required = true) @RequestParam long size,
            String nd,String xzqhdm
    ) {
        return CommonResult.data(iPsbaGtJbqkService.page(current,size,nd,xzqhdm));
    }

    /**
     * 获取审备案非压覆详情
     */
    @ApiOperation("获取审备案非压覆详情")
    @GetMapping("/getPsbaXqVo")
    public CommonResult<PsbaXqVo> getPsbaXqVo(
            @ApiParam(name = "psbabh", value = "评审备案编号") @RequestParam String psbabh
    ) {


        return CommonResult.data(iPsbaGtJbqkService.getPsbaXqVo(psbabh));
    }

    /**
     * 添加评审备案-非压覆详情-不包含资源储量
     */
    @ApiOperation("添加评审备案-非压覆基本情况-不包含资源储量")
    @PostMapping("/addDetail")
    public CommonResult<String> addDetail(@RequestBody @Valid PsbaXqParam psbaXqParam) {
        iPsbaGtJbqkService.addDetail(psbaXqParam);
        return CommonResult.ok();
    }

    /**
     * 添加评审备案-非压覆详情-评审备案矿产资源储量
     */
    @ApiOperation("添加评审备案-非压覆-评审备案矿产资源储量")
    @PostMapping("/addDetailKc")
    public CommonResult<String> addDetailKc(@RequestBody @Valid List<PsbaZycledit> psbaZycledit) {
        iPsbaGtJbqkService.addDetailKc(psbaZycledit);
        return CommonResult.ok();
    }

    /**
     * 非压覆详情查看-评审备案矿产资源储量-编辑按钮外部列表
     */
    @ApiOperation("非压覆详情查看-评审备案矿产资源储量-编辑按钮外部列表")
    @GetMapping("/getDetailKcOut")
    public CommonResult<List<PsbakczyclVo>> getDetailKcOut(@ApiParam(name = "psbabh", value = "评审备案编号") @RequestParam String psbabh) {
        return CommonResult.data(iPsbaGtJbqkService.getDetailKcOut(psbabh));
    }

    /**
     * 非压覆详情查看-评审备案矿产资源储量-编辑列表
     */
    @ApiOperation("非压覆详情查看-评审备案矿产资源储量-编辑列表")
    @GetMapping("/getDetailKc")
    public CommonResult<List<PsbaZycledit>> getDetailKc(@ApiParam(name = "psbabh", value = "评审备案编号") @RequestParam String psbabh) {
        return CommonResult.data(iPsbaGtJbqkService.getDetailKc(psbabh));
    }
}
